package br.com.iswe.gwt.manter.client;

import br.com.iswe.gwt.util.client.BaseForm;
import br.com.iswe.gwt.util.client.CommonConstants;
import br.com.iswe.gwt.util.client.RequiredValidator;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.PasswordTextBox;
import com.google.gwt.user.client.ui.TextBox;

public class LoginForm extends BaseForm {
	protected CommonConstants constants = (CommonConstants)GWT.create(CommonConstants.class);
	
	public LoginForm() {
		super(null);
	}

	public String[] getKeyProperties() {
		return null;
	}
	
	//Campos do formulario
	public final TextBox fLogin = formFactory.buildTextBox(CommonConstants.LOGIN);
	public final RequiredValidator vLogin = new RequiredValidator(fLogin.getName(), constants.login(), fLogin);
	
	public final PasswordTextBox fSenha = formFactory.buildPasswordTextBox(CommonConstants.SENHA);
	public final RequiredValidator vSenha = new RequiredValidator(fSenha.getName(), constants.senha(), fSenha);
	
	/**
	 * Configura os campos.
	 */
	protected void setupFields(){
		formFactory.addValidator(fLogin.getName(), vLogin);
		formFactory.addValidator(fSenha.getName(), vSenha);
	}
}
